package com.ruoyi.cmemetal.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.cmemetal.domain.ZxHeatPreprocess;
import com.ruoyi.cmemetal.service.IZxHeatPreprocessService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * HeatPreprocessController
 * 
 * @author zhangxu
 * @date 2021-12-31
 */
@RestController
@RequestMapping("/HeatPreprocess/HeatPreprocess")
public class ZxHeatPreprocessController extends BaseController
{
    @Autowired
    private IZxHeatPreprocessService zxHeatPreprocessService;

    /**
     * 查询HeatPreprocess列表
     */
    @PreAuthorize("@ss.hasPermi('HeatPreprocess:HeatPreprocess:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZxHeatPreprocess zxHeatPreprocess)
    {
        startPage();
        List<ZxHeatPreprocess> list = zxHeatPreprocessService.selectZxHeatPreprocessList(zxHeatPreprocess);
        return getDataTable(list);
    }

    /**
     * 导出HeatPreprocess列表
     */
    @PreAuthorize("@ss.hasPermi('HeatPreprocess:HeatPreprocess:export')")
    @Log(title = "HeatPreprocess", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZxHeatPreprocess zxHeatPreprocess)
    {
        List<ZxHeatPreprocess> list = zxHeatPreprocessService.selectZxHeatPreprocessList(zxHeatPreprocess);
        ExcelUtil<ZxHeatPreprocess> util = new ExcelUtil<ZxHeatPreprocess>(ZxHeatPreprocess.class);
        util.exportExcel(response, list, "HeatPreprocess数据");
    }

    /**
     * 获取HeatPreprocess详细信息
     */
    @PreAuthorize("@ss.hasPermi('HeatPreprocess:HeatPreprocess:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(zxHeatPreprocessService.selectZxHeatPreprocessById(id));
    }

    /**
     * 新增HeatPreprocess
     */
    @PreAuthorize("@ss.hasPermi('HeatPreprocess:HeatPreprocess:add')")
    @Log(title = "HeatPreprocess", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZxHeatPreprocess zxHeatPreprocess)
    {
        return toAjax(zxHeatPreprocessService.insertZxHeatPreprocess(zxHeatPreprocess));
    }

    /**
     * 修改HeatPreprocess
     */
    @PreAuthorize("@ss.hasPermi('HeatPreprocess:HeatPreprocess:edit')")
    @Log(title = "HeatPreprocess", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZxHeatPreprocess zxHeatPreprocess)
    {
        return toAjax(zxHeatPreprocessService.updateZxHeatPreprocess(zxHeatPreprocess));
    }

    /**
     * 删除HeatPreprocess
     */
    @PreAuthorize("@ss.hasPermi('HeatPreprocess:HeatPreprocess:remove')")
    @Log(title = "HeatPreprocess", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zxHeatPreprocessService.deleteZxHeatPreprocessByIds(ids));
    }
}
